package com.martin.lib_base.net

import com.martin.lib_base.BuildConfig
import com.martin.lib_base.base.BaseResponse
import com.martin.lib_base.bean.UploadBean
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.PartMap
import retrofit2.http.Streaming
import retrofit2.http.Url

interface Api {

    companion object {
        const val BASE_URL = BuildConfig.baseUrl
    }

    //================================= 功能接口 ==============================================

    @POST("upload/")
    @Multipart
    suspend fun uploadFile(
        @Part file: MultipartBody.Part,
        @PartMap map: MutableMap<String, RequestBody>? = null
    ): BaseResponse<UploadBean>

    @GET
    @Streaming
    @Headers("Calldown: download")
    suspend fun download(@Url url: String): ResponseBody

}